<?php
defined('EXEC') or die();

//Verificando recuperar senha
if (@$_POST['nm_login'] && @$_POST['ds_email'] && @$_POST['nm_cpf']) {
	$auth->passRecovery();
}

//Autenticando o usuário e o redirecionando
if(@$_POST['user'] && @$_POST['pass']){	
	$test = $auth->authenticate();
}

?>
<style type="text/css">
#conteudo #login {width: 300px; margin: 0px auto; margin-top: 50px;	margin-bottom: 80px;}
#conteudo #login a { color: #666; }
#conteudo #login input.textLogin { padding: 5px; border: #CCC 1px solid; color: #666; font-size: 16px; width: 180px; }
#conteudo #login fieldset {	border: #CCCCCC 1px dashed;	padding: 10px; margin: 10px; }
#conteudo #login fieldset legend { color: #037D44; font-weight: bold; margin-right: 20px; background: #FFFFFF; padding: 3px; }
</style>

    <div id="topo">
        <div id="nome"><?php echo Config::SYSTEM; ?></div>
		<div class="data-hora" style="margin-top:107px;">
            <img src="assets/icon_date.gif" align="left"/>
             <?php echo date('d/m/Y - H:i'); ?>
        </div>
    </div>    
    <div id="conteudo">
        <div id="login">
			<?php echo @$test; ?>
			<form class="form-horizontal" method="post" role="form">
				<fieldset>
					<legend><img src="assets/icon_cadeado.jpg" align="absmiddle"> Área Restrita</legend>
					<div class="form-group">
						<label class="col-sm-2 control-label">Login:</label>
						<div class="col-sm-10">
							<input name="user" id="user" type="text" maxlength="200" value="<?php echo @$_POST['user']; ?>" class="form-control" placeholder="Digite seu login">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">Senha:</label>
						<div class="col-sm-10">
							<input name="pass" id="pass" type="password" maxlength="200" class="form-control" placeholder="Digite sua senha">
						</div>
						
					</div>
					<div class="form-group">
						<div class="col-sm-2">
						</div>
						<div class="col-sm-10">
							<input class="btn btn-success" id="btLogin" type="submit" value="Enviar" style="width:80px;"/> 
							<input type="hidden" name="url" value="<?php echo $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?>"/>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-2">
						</div>
						<div class="col-sm-10"> 
							<a href="" data-toggle="modal" data-target="#myModal"><img src="assets/icon_interrogacao.jpg"/> Esqueceu a senha?</a>
						</div>
					</div>
				</fieldset>
			</form>
        </div>
    </div>
    
    <!-- Modal -->
	<div class="modal fade" id="myModal" tabindex="0" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
	        <h4 class="modal-title">Recuperação de senha</h4>
	      </div>
	      <div class="modal-body">
			<form class="form-horizontal" role="form" method="post">
				<div class="form-group">
					<label for="inputEmail3" class="col-sm-4 control-label">Login:</label>
					<div class="col-sm-5">
						<input name="nm_login" id="nm_login" type="text" placeholder="Digite seu usuário" size="35" maxlength="200" class="form-control" style="padding:4px;">
					</div>
				</div>
				<div class="form-group">
					<label for="inputEmail3" class="col-sm-4 control-label">E-mail:</label>
					<div class="col-sm-5">
						<input name="ds_email" id="ds_email" placeholder="Informe seu e-mail" type="text" size="35" maxlength="200" class="form-control" style="padding:4px;">
					</div>
				</div>
				<div class="form-group">
					<label for="inputEmail3" class="col-sm-4 control-label">CPF:</label>
					<div class="col-sm-5">
						<input name="nm_cpf" id="nm_cpf" placeholder="Informe seu CPF" type="text" onkeypress="mask(this, cpf)" size="20" maxlength="14" class="form-control" style="padding:4px;">
					</div>
				</div>
			
	      </div>
	      <div class="modal-footer">
	      	<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
	        <button type="submit" class="btn btn-success" id="btn-enviar">Enviar</button></form>
	      </div>
	    </div><!-- /.modal-content -->
	  </div><!-- /.modal-dialog -->
	</div><!-- /.modal -->	
	
    <div id="rodape">
	&#169; 2013 - Governo do Estado do Ceará - Todos os direitos reservados
	</div>
